
xflatcheckandcombine (  )
{
    dir_now=`pwd`
    dirFlat="/disk2/test/xlp2/svom/caliFile/Flat"
    #dirFlatg="/disk2/test/xlp2/svom/caliFile/Flat_g.fit"
    #dirFlati="/disk2/test/xlp2/svom/caliFile/Flat_i.fit"
    dirZero="/disk2/test/xlp2/svom/caliFile/Zero.fit"
    filter=`gethead $fitname "filter"`
    flatnamedir=`echo $dirFlat"_"$filter".fit"`
    if [ -r $flatnamedir ] && [ -r $dirZero  ]
    then
            cp $flatnamedir $dirZero ./
            flatname=`echo "Flat_"$filter".fit"`
            xzeroflatcorr.sh $fitname $flatname
    fi
}


fitname=$1
xflatcheckandcombine
